package com.pml.listener;

import javax.servlet.http.HttpSessionBindingEvent;
import javax.servlet.http.HttpSessionBindingListener;

public class SessionBoundListener implements HttpSessionBindingListener {


    private String name;
    public SessionBoundListener(String name){
        this.name=name;
    }
    @Override
    public void valueBound(HttpSessionBindingEvent httpSessionBindingEvent) {
        System.out.println("valueBound():"+this.name+";id="+httpSessionBindingEvent.getSession().getId()+"   "
                +httpSessionBindingEvent.getName()+"="+httpSessionBindingEvent.getValue());
    }


    @Override
    public void valueUnbound(HttpSessionBindingEvent httpSessionBindingEvent) {
        System.out.println("valueUnbound():"+this.name+";"+httpSessionBindingEvent.getSession().getId()
                +httpSessionBindingEvent.getName()+"="+httpSessionBindingEvent.getValue());
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

}
